import Graphics2d from '../v1/g2d';
import Graphics2dGourand from '../v1/g2d_gourand';
import Graphics3d from '../v1/g3d';
import Graphics3dGourand from '../v1/g3d_gourand';

let globalGraphics = {
    flat2d:null,
    gourand2d:null,
    flat3d:null,
    gourand3d:null,

    init(imageData){
        this.flat2d = new Graphics2d(imageData);
        this.gourand2d = new Graphics2dGourand(imageData);
        this.flat3d = new Graphics3d(imageData);
        this.gourand3d = new Graphics3dGourand(imageData);
    },

    clear(){
        this.gourand3d.clear();
    },

    viewPort(p){
        p.x = Math.floor((p.x + 1) * (app.width - 1) / 2);
        p.y = Math.floor((p.y + 1) * (app.height - 1) / 2);
        return p;
    }
};

export default globalGraphics;
